So, I have been trying to build a simple slider to act as a scrollbar for a group of images inside a div.
I got really close to getting it work a few times. Ive probably done 4 or 5 tutorials none of which seemed to work.
So, I have back tracked it to be based off the jQuery documentation stuff.
Still no dice.
I'm getting two errors in Chrome using the developer tools :
1st - on line 44 in my html file : "Uncaught TypeError: Object #<an Object> has no method "slider"". which means that the browser cant find the slider - Im not sure why thats happening.
2nd - in the actual jQuery UI js file : "Uncaught ReferenceError: jQuery is not defined" - I have no idea why that is happening, I just downloaded it fresh off the jQuery UI page with everything selected (no theme though).
Maybe someone out there may catch what I am doing wrong.
I'm supposed to send the client a comp by later today.
Here is my code:
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Sam Gezari \\ Los Angeles Based Photographer</title>
- <link rel="stylesheet" href="main.css" />
- <script type="text/javascript" src="jquery-ui-1.8.4.custom.min.js"></script>
- <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
- <script type="text/javascript">
- document.createElement('header');
- document.createElement('nav');
- document.createElement('article');
- document.createElement('section');
- document.createElement('footer');
- document.createElement('canvas');
- </script>
- <script type="text/javascript">
- $(document).ready(function(){
- //--------------------SET CURRENT PAGE-----------------------\\
-
-
- //--------------------LOAD IMAGES FROM XML--------------------\\
- $.get('newimages.xml', function(d){
- $(d).find('image').each(function(){
- var $image = $(this);
- var imageUrl = $image.attr("url");
-
- var html = '<div class="imageContainer">';
- html += '<img src="' + imageUrl + '" />';
- html += '</div>';
-
- $('#content').append($(html));
- });
- });
-
- //--------------------SLIDE INIT-------------------------\\
- var container = $('#mask');
- var items = $('#content');
- var itemsWidth = items.innerWidth() - container.outerWidth();
-
- $('#slider').slider({
- minValue: 0,
- maxValue: itemsWidth,
- handle: '#handle',
- stop: function (event, ui) {
- items.animate({'left' : ui.value * -1}, 1000);
- },
- slide: function (event, ui) {
- items.css({'left' : ui.value * -1});
- }
- });
-
- });
- </script>
- </head>
- <body>
- <nav>
- <h1><span class="light">sam</span> gezari</h1>
- <ul id="main">
- <li class="currentPage">new   </li>
- <li><a href="#">past</a>   </li>
- <li><a href="#">book</a>   </li>
- <li><a href="#">video</a>   </li>
- <li><a href="#">cv</a>   </li>
- </ul>
- </nav>
- <div id="mask">
- <div id="content">
- </div>
- </div>
- <div id="slider">
- <div id="handle"></div>
- </div>
- </body>
- </html>
Thanks for any help!